/*
** FileName:2028.c
** Author:Creat
** Time:下午2:32
** Date:2024/5/27
**/
#include "stdlib.h"
#include "string.h"
int* missingRolls(int* rolls, int rollsSize, int mean, int n, int* returnSize) {
    int total = mean * (rollsSize + n);
    int* res = (int*)malloc(sizeof(int) * n);
    memset(res, 0, sizeof(int) * n);
    for(int i = 0;i < rollsSize;i++)
        total -= rolls[i];
    int div = total / n;
    int remain = total % n;
    if((1 * n > total) || (6 * n < total)){
        *returnSize = 0;
        return NULL;
    }
    div = total / n;
    for(int i = 0;i < n;i++)
        res[i] = div;
    for(int i = 0;i < remain;i++)
        res[i]++;
    *returnSize = n;
    return res;
}